package com.zixuan.yuojbackendjudgeservice.judge.strategy;



import com.zixuan.yuojbackendmodel.model.codesandbox.JudgeInfo;
import com.zixuan.yuojbackendmodel.model.entity.QuestionSubmit;
import org.springframework.stereotype.Service;

/**
 * 判题管理，简化调用，策略选择
 * @author Mr.Mei
 * @date 2023/11/14
 */
@Service
public class JudgeManage {
    public JudgeInfo doJudge(JudgeContext judgeContext) {
        QuestionSubmit questionSubmit = judgeContext.getQuestionSubmit();
        String language = questionSubmit.getLanguage();
        JudgeStrategy judgeStrategy = new DefaultJudgeStrategy();
        if (language.equals("java")) {
            judgeStrategy = new JavaJudgeStrategy();
        }
        return judgeStrategy.doJudge(judgeContext);
    }
}
